package com.heima.wemedia.feign;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.ChannelDto;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.wemedia.service.WmChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: xrl
 * @Date: 2022/10/22  14:16
 * @Version 1.0
 * 频道
 */
@RestController
public class WmChannelClient {

    @Autowired
    private WmChannelService wmChannelService;

    /**
     * 频道列表查询
     */
    @PostMapping("/api/v1/channel/list")
    public ResponseResult selectAllChannel(@RequestBody ChannelDto dto) {
        return wmChannelService.selectAllChannel(dto);
    }

    /**
     * 删除频道
     */
    @GetMapping("/api/v1/channel/del/{id}")
    public ResponseResult delChannel(@PathVariable("id") Integer id) {
        return wmChannelService.delChannel(id);
    }

    /**
     * 新增频道
     */
    @PostMapping("/api/v1/channel/save")
    public ResponseResult saveChannel(@RequestBody WmChannel wmChannel) {
        return wmChannelService.saveChannel(wmChannel);
    }

    /**
     * 修改频道
     */
    @PostMapping("/api/v1/channel/update")
    public ResponseResult updateChannel(@RequestBody WmChannel wmChannel) {
        return wmChannelService.updateChannel(wmChannel);
    }

}
